﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Security;
namespace Data.Entity
{
    public class User
    {
        [Key]
        public int ID { get; set; }

        [StringLength(20, MinimumLength = 6)]
        [Required]
        public string UserName { get; set; }

        [StringLength(255, MinimumLength = 6)]
        [Required]
        public string FullName { get; set; }

        [MembershipPassword(
        MinRequiredPasswordLength = 8,
        ErrorMessage = "Your password needs to be at least 8 characters long",
        MinRequiredNonAlphanumericCharacters = 1,
        MinNonAlphanumericCharactersError = "At least one of the characters needs to be non-alphanumeric")]
        public string Password { get; set; }

        [Required]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [DataType(DataType.PhoneNumber)]
        public string Phone { get; set; }

        [DefaultValue(1)]
        public bool IsActive { get; set; }

        public int RandomKey { get; set; }

        public int CompanyID { get; set; }

        public int PositionID { get; set; }

        public int DepartmentID { get; set; }

        public int BranchID { get; set; }

        public Boolean IsDelete { get; set; }

        public Boolean IsStatus { get; set; }

        private DateTime _CreateDate = DateTime.Now;
        public DateTime CreateDate { get { return _CreateDate; } set { _CreateDate = value; } }


        private DateTime _UpdateDate = DateTime.Now;
        public DateTime UpdateDate { get { return _UpdateDate; } set { _UpdateDate = value; } }

        public int? UpdateUser { get; set; }

        private DateTime _DeleteDate = DateTime.Now;
        public DateTime DeleteDate { get { return _DeleteDate; } set { _DeleteDate = value; } }

        public int? DeleteUser { get; set; }

        [ForeignKey("CompanyID")]
        public virtual Company Company { get; set; }

    }
}
